/**
 * Contains code to make the footer stick to the bottom of the page.
 *
 * @category BuyLocal
 * @package  BuyLocal
 * @author   Kevin Fodness <kevin.fodness@gmail.com>
 * @author   Mike Pennisi <mpennisi@andrew.cmu.edu>
 * @author   Aaron Ryden <aryden@gmail.com>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://code.google.com/p/buylocalopensourcerensselaer/
 * @link     http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
 */

function adjust()
{
    /**
     * Gets the working height of the window.
     */
    var screenHeight = 0;
    if (typeof(window.innerWidth) == 'number') {
        screenHeight = window.innerHeight;
    } else if (
        document.documentElement 
        && (
            document.documentElement.clientWidth 
            || document.documentElement.clientHeight
        )
    ) {
        screenHeight = document.documentElement.clientHeight;
    } else if (
        document.body
        && (
            document.body.clientWidth
            || document.body.clientHeight
        )
    ) {
        screenHeight = document.body.clientHeight;
    }
    
    /**
     * Sets the minimum height of the content area to the screen height minus
     * the height of the header and the footer.
     */
    var headerHeight = window.document.getElementById('header').offsetHeight;
    var footerHeight = window.document.getElementById('footer').offsetHeight;
    var minHeight = (screenHeight - headerHeight - footerHeight) + 'px';
    window.document.getElementById('content').style.minHeight = minHeight;
}
